package com.heima.controller;

import com.heima.pojo.dto.PartnerQueryDTO;
import com.heima.pojo.dto.RegionDTO;
import com.heima.pojo.vo.SkuClassPageVO;
import com.heima.service.RegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/vm-service/region")
public class RegionController {
    @Autowired
    private RegionService regionService;


    @GetMapping("/search")
    public SkuClassPageVO search( PartnerQueryDTO partnerQueryDTO) {
        return regionService.search(partnerQueryDTO);
    }
    @PostMapping
    public Boolean saveRegion(@RequestBody RegionDTO regionDTO) {

        return regionService.saveRegion(regionDTO);
    }
    @PutMapping("/{regionId}")
    public Boolean updateRegion(@PathVariable String regionId, @RequestBody RegionDTO regionDTO) {
        return regionService.updateRegion(regionId, regionDTO);
    }
    @DeleteMapping("/{regionId}")
    public Boolean deleteRegion(@PathVariable String regionId) {
        return regionService.deleteRegion(regionId);
    }
}
